package com.hbnu.util;


public class HibernateUtil {
    private static Configuration configuration = null;
    private static SessionFactory sessionFactory = null;

    static {
        configuration = new Configuration().configure();
        sessionFactory = configuration.buildSessionFactory();
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }


    public static Session getSession() {
//        获取与本地线程绑定的session对象
        return sessionFactory.getCurrentSession();
    }
}